﻿/* ===== Overlay + Panel (transiciones) ===== */
.buscador-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.buscador-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.buscador-panel {
  position: relative; /* <-- importante para anclar el botón de cerrar */
  background: #fff;
  width: min(640px, 95vw);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
  padding: 24px 24px 20px;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.buscador-panel.is-open {
  transform: scale(1);
  opacity: 1;
}

/* ===== Botón cerrar ===== */
.buscador-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2; /* asegura que quede por encima del contenido */
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #fee2e2;
  color: #dc2626;
  border: 0;
  border-radius: 9999px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.buscador-close:hover {
  background: #dc2626;
  color: #fff;
  transform: rotate(90deg);
}

/* ===== Chips (micrófono / clear) ===== */
.buscador-chip-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #2563eb;
  border: 0;
  border-radius: 9999px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.buscador-chip-btn:hover {
  background: #2563eb;
  color: #fff;
  transform: scale(1.05);
}
.hidden {
  display: none !important;
}

/* ===== Estados de foco accesibles ===== */
.buscador-close:focus-visible,
.buscador-chip-btn:focus-visible,
.buscador-link:focus-visible,
.pill:focus-visible {
  outline: 3px solid #93c5fd; /* azul claro */
  outline-offset: 2px;
  border-radius: 10px;
}

/* ===== Efecto micrófono activo ===== */
.buscador-pulse {
  animation: busc-pulse 1s ease-in-out infinite;
}
@keyframes busc-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

/* ===== Link de resultado ===== */
.buscador-link {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e40af;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.buscador-link:hover {
  color: #0b47ff;
}

/* ===== Loader (basado en tu versión) ===== */
.buscador-loader {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  border: 3px solid;
  border-color: #fff #fff transparent transparent;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}
.buscador-loader::after,
.buscador-loader::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  border: 3px solid;
  box-sizing: border-box;
  border-color: transparent transparent #ff3d00 #ff3d00;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  animation: rotationBack 0.5s linear infinite;
  transform-origin: center;
}
.buscador-loader::before {
  width: 32px;
  height: 32px;
  border-color: #fff #fff transparent transparent;
  animation: rotation 1.5s linear infinite;
}
@keyframes rotation {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rotationBack {
  to {
    transform: rotate(-360deg);
  }
}

/* ===== Estado: Sin resultados ===== */
.nores-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
  justify-items: center;
  padding: 20px;
  text-align: center;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
}
@media (min-width: 560px) {
  .nores-wrap {
    grid-template-columns: 180px 1fr;
    text-align: left;
    justify-items: start;
  }
}
.nores-illu {
  width: 160px;
  height: 96px;
  opacity: 0.9;
}
.nores-illu svg {
  width: 100%;
  height: 100%;
}
.nores-title {
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}
.nores-tips {
  color: #374151;
  font-size: 0.875rem;
  margin: 0 0 10px 1rem;
}
.nores-tips li {
  list-style: disc;
  margin: 4px 0;
}
.nores-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #3730a3;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  transition: transform 0.15s ease, background 0.2s ease;
}
.pill:hover {
  transform: translateY(-1px);
  background: #e0e7ff;
}

/* ===== Preferencias del usuario ===== */
@media (prefers-reduced-motion: reduce) {
  .buscador-overlay {
    transition: none;
  }
  .buscador-panel {
    transition: none;
    transform: none !important;
    opacity: 1 !important;
  }
  .buscador-pulse {
    animation: none;
  }
  .buscador-loader,
  .buscador-loader::before,
  .buscador-loader::after {
    animation: none;
  }
}

/* ===== Scrollbar suave (opcional, soportado en WebKit/Chromium) ===== */
#resultados::-webkit-scrollbar {
  width: 10px;
}
#resultados::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 8px;
}
#resultados::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}
#resultados::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== Ajuste opcional para móviles: evita solape con el logo/título ===== */
@media (max-width: 480px) {
  .buscador-panel {
    padding-top: 40px;
  }
}
